import request from '@/utils/request'
// 获取-员工列表
export const getEmployeeAPI = params => request('/sys/user', { params })

// 批量-导出员工excel
export const exportExcelAPI = (params) => {
  return request({ url: '/sys/user/export',
    //  告诉后端响应blob数据格式
    responseType: 'blob' }) // 二进制文件流
}

// 批量-下载导入员工模板
export const importExcelAPI = () => {
  return request({
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}

// 批量-导入员工(上传excel)
export const uploadExcelAPI = data => {
  return request({
    url: '/sys/user/import',
    method: 'post',
    data
  })
}

// 删除-员工
export const delEmployeeAPI = id => request.delete(`/sys/user/${id}`)

// 新增-员工
export const addEmployeeAPI = data => request.post(`/sys/user`, data)

// 获取-员工-基本信息
export const getEmployeeDetailAPI = id => request.get(`/sys/user/${id}`)

// 修改-员工-基本信息
export const editEmployeeAPI = data => request.put(`/sys/user/${data.id}`, data)

// 分配-员工-角色
export const putAssignRolesAPI = data => request.put('/sys/user/assignRoles', data)
